package com.example.pt.config;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.wltea.analyzer.core.IKSegmenter;

import java.io.StringReader;

/**
 * IK分词器配置类
 */
@Configuration
public class IKAnalyzerConfig {
    
    private static final Logger logger = LoggerFactory.getLogger(IKAnalyzerConfig.class);
    
    /**
     * 创建IK分词器工厂方法
     * @param text 待分词文本
     * @param useSmart 是否使用智能分词模式
     * @return IK分词器实例
     */
    public static IKSegmenter createIKSegmenter(String text, boolean useSmart) {
        return new IKSegmenter(new StringReader(text), useSmart);
    }
} 